
// 省份数据格式的转化
function iterator(list) {
    var dataList = [];
    list.forEach(function (p) {
        var cityList = [];
        p['city'].forEach(function (c) {
            cityList.push({"text": c['cname'],"value": c['id']});
        });
        console.log(cityList);
        dataList.push({"text": p['pname'], "children": cityList});
    });
    return dataList;
}

// 银行卡数据格式的转化

function bankname(bankData){
    var bankList=[];
    var hot=[];
    for(var key in bankData){
        var bankName=[];
        bankData [key].forEach(function(name){
            bankName.push({"text" : name.bankname , "value" : name.id});
            if(name.hot==1){
                hot.push({"text" : name.bankname , "value" : name.id});
            }
        });
        // console.log(hot);
        bankList.push({ "text" : key , "children" : bankName});
    }
    bankList.unshift({ "text" : "热门" , "children" : hot});

    return bankList;
}